package edu.itcs6112.za.service.jpa;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import edu.itcs6112.za.domain.Order;
import edu.itcs6112.za.repository.OrderRepository;
import edu.itcs6112.za.service.OrderService;


@Service("orderService")
@Repository
@Transactional
public class OrderServiceImpl implements OrderService {
	
	
	@Autowired
	private OrderRepository orderRepository;
	
	@Override
	public List<Order> findAllCustomerOrders(Long customerId) {
		return orderRepository.findByCustomerId(customerId);
	}

	@Override
	public Order save(Order order) {
		return orderRepository.save(order);
	}
	
}
